home *** CD-ROM | disk | FTP | other *** search
- *-------------------------------------------------------------------------------
- *-- Program.....: BORENTR.PRG
- *-- Programmer..: Ken Mayer
- *-- Date........: 06/12/1992
- *-- Notes.......: Used to enter data to ATUSER.DBF, created by Tony Lima,
- *-- uses basic layout from his ATUSERS.FMT file ...
- *-- Written for.: dBASE IV, 1.1/1.5
- *-- Rev. History: Tony created the input screen, I copied/modified for the
- *-- data entry program ...
- *-------------------------------------------------------------------------------
-
- save screen to sEnter
- cEntColor = set("ATTRIBUTES")
- clear
- x=scrnhead("&cStand2","BOR-BBS Users Database - Data Entry")
- *-- 03/27/1992 -- use of NETWORK() function so that packs don't
- *-- cause problems ...
- if network()
- use atusers excl
- else
- use atusers
- endif
- *-- Added following line 12/30/91, Tony Lima
- use atusers order borbbs_id noupdate again in 2
-
- *-- window for 'bio' field ...
- define window wBio from 9,10 to 20,79 double
-
- lPgUp = .f. && used if user presses <PgUp> in second screen ...
- lDone = .f. && used if we have a blank record and end of first screen
- && occurs.
- lDone2 = .f. && used with <Ctrl><end> to exit first screen and entering
- && of data
-
- do while .t. && Main Enter loop
-
- *-- Basically, if the user pressed <PgUp>, we're still working on the
- *-- old record. Otherwise, if we're here, we want a new record ...
- lDone2 = .f. && set 'false' ...
- if lPgUp
- lPgUp = .f.
- else
- append blank
- endif
-
- *------------------------------------------------------------------
- *-- SCREEN 1
- *------------------------------------------------------------------
- do while .t. && first screen
-
- @5,0 clear
-
- @ 6,8 SAY "BORBBS ID:"
- * Following line modified by Tony Lima, 12/30/91, to set to
- * all capital letters and to add VALID with UDF
- @ 6,19 GET Borbbs_id PICTURE "@!" valid NoDupe() ;
- error chr(7)+"BORBBS ID already in dbf. Use Edit instead."
- @ 7,13 SAY "Name:"
- @ 7,19 GET First_name picture "!XXXXXXXXXXXXXXXXXXXXXXXX";
- message "First Name"
- @ 7,45 GET Mi PICTURE "!" message "Middle Initial"
- @ 7,47 GET Last_name picture "!XXXXXXXXXXXXXXXXXXXXXXXX";
- message "Last Name"
- @ 8,8 SAY "Honorific:"
- @ 8,19 GET Honorific PICTURE "!XXXXX";
- message "Honorific (Mr., Mrs., Ms., Dr., etc.)"
- @ 8,26 say "Bio: "
- @ 8,31 get bio window wBio;
- message ;
- "Interests of user -- press <Ctrl><Home> to enter, <Ctrl><End> when done"
- @ 10,10 SAY "Company:"
- @ 10,19 GET Company message ""
- @ 11,12 SAY "Title:"
- @ 11,19 GET Title message "Enter Job Title"
- @ 12,10 SAY "Address:"
- @ 12,19 GET Baddress1
- @ 13,19 GET Baddress2 message "Enter if second address line necessary";
- when .not. isblank(bAddress1)
- @ 14,19 GET Bcity message "City"
- @ 14,44 SAY ","
- @ 14,46 GET Bstate PICTURE "!!" valid required state(bState);
- message "State"
- @ 14,50 GET Bzip PICTURE "#####-####" message "Zip"
- @ 15,7 SAY "Work Phone:"
- @ 15,19 GET Bphone PICTURE "@R (999) 999-9999"
- *-- Fax number was moved to the Business/Job section as most people don't
- *-- have a fax at home ...
- @ 15,36 SAY "Fax:"
- @ 15,41 GET Fax PICTURE "@R (999) 999-9999"
- @ 17,13 SAY "Home:"
- @ 17,19 GET Haddress1
- @ 18,19 GET Haddress2 message "Enter if second address line necessary";
- when .not. isblank(haddress1)
- @ 19,19 GET Hcity message "City"
- @ 19,44 SAY ","
- @ 19,46 GET Hstate PICTURE "!!" valid required state(hstate);
- message "State"
- @ 19,50 GET Hzip PICTURE "#####-####" message "Zip"
- @ 20,7 SAY "Home Phone:"
- @ 20,19 GET Hphone PICTURE "@R (999) 999-9999"
- @ 21, 8 SAY "BBS Phone:"
- @ 21,19 GET Bbsphone PICTURE "@R (999) 999-9999"
- do center with 23,80,;
- "&cStand3","Press <PgDn> for next screen (or to skip this one)"
-
- read
-
- *-- save that keystroke ...
- nI = readkey()
- if nI > 255
- nI = nI - 256
- endif
-
- *-- remove message lines ...
- @23,0 clear
-
- *-- is this a blank record? (Uses internal ISBLANK() if 1.5+, or
- *-- function EMPTY() renamed to ISBLANK() in PROC.PRG file otherwise)
- *-- OR did user press <Esc> key?
- if ((IsBlank(borbbs_id) .and. IsBlank(last_name)) .or. lastkey() = 27);
- .and. yesno2(.f.,"BC","This record is empty!","Is this ok?",;
- "(it will be deleted ...)","&cl_wind2")
- lDone = .t. && set this so we don't go into next screen
- delete && tag it for deletion
- exit && exit loop
- endif
-
- *-- check for ^<End> ...
- if nI+256 = 270 && ^<End> or ^W
- @22,0 clear
- cYN = "Y"
- @23,25 say "Finished with this record? " get cYN picture "!";
- valid required cYN $ "YN";
- error chr(7)+"Enter 'Y' or 'N'"
- read
-
- if cYN = "Y"
- lDone2 = .t.
- exit
- else
- lDone2 = .f.
- exit
- endif
-
- endif
-
- *-- check with user to ensure screen ok ...
- @22,0 clear
- cYN = "Y"
- @23,25 say "Is this screen ok? " get cYN picture "!";
- valid required cYN $ "YN";
- error chr(7)+"Enter 'Y' or 'N'"
- read
-
- *-- if it IS ok, exit screen 1
- if cYN = "Y"
- exit
- endif
-
- enddo && end of first screen
-
- *------------------------------------------------------------------
- *-- SCREEN 2
- *------------------------------------------------------------------
- do while .t. && second screen
-
- if lDone .or. lDone2 && blank record (or user pressed <Esc> in screen 1)
- && or <Ctrl><End>
- exit
- endif
-
- @5,0 clear
-
- @ 6,8 SAY "BORBBS ID:"
- @ 6,19 get Borbbs_id
- @ 7,13 SAY "Name:"
- @ 7,19 get First_name
- @ 7,45 GET Mi
- @ 7,47 GET Last_name
- clear gets && these (above) are display only
-
- @ 9,7 SAY "CompuServe:"
- @ 9,19 GET Compuserve
- @ 10,9 SAY "MCI_Mail:"
- @ 10,19 GET Mci_mail
- @ 11,12 SAY "GEnie:"
- @ 11,19 GET Genie
- @ 12,13 SAY "FIDO:"
- @ 12,19 GET Fido
- @ 13,9 SAY "InterNet:"
- @ 13,19 GET Internet
- @ 14,11 SAY "Source:"
- @ 14,19 GET Source
- @ 15,10 SAY "Prodigy:"
- @ 15,19 GET Prodigy
- @ 16,11 SAY "Delphi:"
- @ 16,19 GET Delphi
- @ 17,3 SAY "America OnLine:"
- @ 17,19 GET Am_online
-
- do center with 22,80,"&cStand3","Press <PgUp> for previous screen"
- do center with 23,80,"&cStand3",;
- "Press <PgDn> or <Ctrl><End> to complete/skip this screen"
- read
-
- activate screen
- @22,0 clear
-
- *-- set flag to go to previous screen
- if lastkey() = 18 && <PgUp> key was pressed
- lPgUp = .t.
- exit
- endif
-
- *-- ask user if screen is alright
- @22,0 clear
- cYN = "Y"
- @23,25 say "Is this screen ok? " get cYN picture "!";
- valid required cYN $ "YN";
- error chr(7)+"Enter 'Y' or 'N'"
- read
-
- *-- if it is, exit this screen ...
- if cYN = "Y"
- exit
- endif
-
- enddo && while .t. -- second screen
-
- if lPgUp && user hit <PgUp> on second screen?
- loop
- endif
-
- if lDone && if last record was blank, or <Esc> pressed, we done ...
- exit
- endif
-
- *-- check for more records ...
- if yesno(.f.,"More?","Do you wish to add","another record?",;
- "&cl_wind1")
- loop
- else
- exit
- endif
-
- enddo && end of main loop
-
- *-- deal with blank records, if any ...
- delete for IsBlank(borbbs_id) .and. IsBlank(last_name)
- count to nDel for deleted()
- if nDel > 0
- set cursor off
- x=surround(12,24,"&cStand3","... One moment ... Cleaning up ...")
- pack
- set cursor on
- endif
-
- *-- cleanup
- close database
- restore screen from sEnter
- release screen sEnter
- release window wBio
- do ReColor with cEntColor && restore old colors
-
- *--------------------------------------------------------------------------
- *-- back to menu ...
- *--------------------------------------------------------------------------
- RETURN
- *-- EoP: BORENTR.PRG
-
- FUNCTION NoDupe && added by TonyLima
-
- *-- work area 2
- Select 2
- *-- look for it
- seek A->Borbbs_id
- *-- if NOT found, we're fine ...
- if .not. found()
- select 1
- lReturn = .T.
- else
- select 1
- lReturn = .F.
- endif
-
- RETURN lReturn
- *-- EoF: NoDupe()
-
- *-------------------------------------------------------------------------------
- *-- EoF: BORENTR.PRG
- *-------------------------------------------------------------------------------